﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using S.RBAC.Domain.Model;
using S.RBAC.Read.Api.Application.Command.OperationCommand;

namespace S.RBAC.Read.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class OperationController : ControllerBase
    {
        protected readonly IMediator _mediator;

        public OperationController(IMediator mediator)
        {
            _mediator = mediator;
        }

        /// <summary>
        /// 获取功能信息列表
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<Operation>> GetAllOperations([FromQuery]OperationGetAllCommand command)
        {
            return await _mediator.Send(command);
        }
    }
}
